/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * 
 * @author edilson
 */
@Entity
@Table(name = "associacao")
public class Associacao implements Serializable {
	private static final long serialVersionUID = 1L;
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private long id = 0;

	@Column(name = "inicio")
	@Temporal(TemporalType.DATE)
	private Date inicio;

	@Column(name = "termino")
	@Temporal(TemporalType.DATE)
	private Date termino;

	// @Max(value=?) @Min(value=?)//if you know range of your decimal fields
	// consider using these annotations to enforce field validation
	@Column(name = "contribuicao")
	private Double contribuicao;

	@ManyToOne
	@JoinColumn(name = "associado", referencedColumnName = "id")
	private Associado associado;

//	public Associacao() {
//	}
//
//	public Associacao(Integer id) {
//		this.id = id;
//	}
//
//	public Associacao(Integer id, Associado associado) {
//		this.id = id;
//		this.associado = associado;
//	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public Date getInicio() {
		return inicio;
	}

	public void setInicio(Date inicio) {
		this.inicio = inicio;
	}

	public Date getTermino() {
		return termino;
	}

	public void setTermino(Date termino) {
		this.termino = termino;
	}

	public Double getContribuicao() {
		return contribuicao;
	}

	public void setContribuicao(Double contribuicao) {
		this.contribuicao = contribuicao;
	}

	@Override
	public String toString() {
		return "br.org.cm.assutef.entities.Associacao[ id=" + id + " ]";
	}

	public Associado getAssociado() {
		return associado;
	}

	public void setAssociado(Associado associado) {
		this.associado = associado;
	}

}
